import http from "./http";

// 添加
export const postArticle = (_article) => {
    return http.requestPost("/admin/article", _article);
}

// 获取列表
export const listArticle = (_page, _size, state, keyword, categoryId) => {
    return http
        .requestGet("/admin/article/list/" + _page + "/" + _size + "?state=" + state + "&keyword=" + keyword + "&categoryId=" + categoryId);
}

// 置顶
export const topArticle = (_id) => {
    return http.requestPut("/admin/article/top/" + _id);
}

// 删除
export const deleteArticle = (_id) => {
    return http.requestDelete("/admin/article/" + _id);
}

// 删除
export const deleteArticleByState = (_id) => {
    return http.requestPut("/admin/article/state/" + _id);
}

// 获取单个
export const getArticle = (_id) => {
    return http.requestGet("/admin/article/" + _id);
}

// 更新
export const putArticle = (_article) => {
    return http.requestPut("/admin/article/" + _article.id, _article);
}

export const getArticleCount = () => {
    return http.requestGet("/admin/article/count");
}